import { createSlice } from "@reduxjs/toolkit"
import {
  addComponentReducer,
  addModalComponentReducer,
  addPageNodeWithSortOrderReducer,
  addSectionViewConfigByConfigReducer,
  addSectionViewReducer,
  addSubPageReducer,
  addTargetPageSectionReducer,
  batchUpdateComponentLayoutInfoReducer,
  batchUpdateComponentLayoutInfoWhenReflowReducer,
  batchUpdateMultiComponentSlicePropsReducer,
  deleteComponentNodeReducer,
  deleteCurrentPageStyleReducer,
  deleteGlobalStateByKeyReducer,
  deletePageNodeReducer,
  deleteSectionViewReducer,
  deleteSubPageViewNodeReducer,
  deleteTargetPageSectionReducer,
  initComponentReducer,
  resetComponentsReducer,
  setComponentPropsReducer,
  setGlobalStateReducer,
  sortComponentNodeChildrenReducer,
  updateComponentDisplayNameReducer,
  updateComponentLayoutInfoReducer,
  updateComponentNodeHeightReducer,
  updateComponentPositionReducer,
  updateComponentPropsReducer,
  updateComponentReflowReducer,
  updateCurrentPageStyleReducer,
  updateDefaultSubPagePathReducer,
  updateMultiComponentPropsReducer,
  updateRootNodePropsReducer,
  updateSectionViewPropsReducer,
  updateSubPagePathReducer,
  updateTargetPageLayoutReducer,
  updateTargetPagePropsReducer,
  updateViewportSizeReducer,
} from "@/redux/currentApp/components/componentsReducer"
import { ComponentsInitialState } from "@/redux/currentApp/components/componentsState"

const componentsSlice = createSlice({
  name: "components",
  initialState: ComponentsInitialState,
  reducers: {
    updateComponentNodeHeightReducer,
    addComponentReducer,
    initComponentReducer,
    updateComponentPropsReducer,
    setComponentPropsReducer,
    deleteComponentNodeReducer,
    sortComponentNodeChildrenReducer,
    updateComponentDisplayNameReducer,
    updateComponentReflowReducer,
    updateComponentPositionReducer,
    updateMultiComponentPropsReducer,
    updateTargetPageLayoutReducer,
    updateTargetPagePropsReducer,
    deleteTargetPageSectionReducer,
    addTargetPageSectionReducer,
    updateRootNodePropsReducer,
    addPageNodeWithSortOrderReducer,
    deletePageNodeReducer,
    addSectionViewReducer,
    addSectionViewConfigByConfigReducer,
    deleteSectionViewReducer,
    updateSectionViewPropsReducer,
    updateViewportSizeReducer,
    addModalComponentReducer,
    resetComponentsReducer,
    updateComponentLayoutInfoReducer,
    batchUpdateComponentLayoutInfoWhenReflowReducer,
    batchUpdateMultiComponentSlicePropsReducer,
    batchUpdateComponentLayoutInfoReducer,
    setGlobalStateReducer,
    deleteGlobalStateByKeyReducer,
    deleteSubPageViewNodeReducer,
    updateSubPagePathReducer,
    updateDefaultSubPagePathReducer,
    addSubPageReducer,
    updateCurrentPageStyleReducer,
    deleteCurrentPageStyleReducer,
  },
})

export const componentsActions = componentsSlice.actions
export default componentsSlice.reducer
